package com.liu.spi;

import com.liu.spi.domain.Log;
import org.springframework.core.io.support.SpringFactoriesLoader;

import java.util.List;

/**
 * @author LIU
 * @version 1.0
 * @date 2024/6/18 10:29
 * @description TODO
 *
 * loadSpringFactories
 * Enumeration urls = classLoader.getResources("META-INF/spring.factories");
 */
public class SpringSpi {
    public static void main(String[] args) {
        List<String> list = SpringFactoriesLoader.loadFactoryNames(Log.class, SpringSpi.class.getClassLoader());
        for (String str : list) {
            System.out.println(str);
        }

        List<Log> logs = SpringFactoriesLoader.loadFactories(Log.class, SpringSpi.class.getClassLoader());
        for (Log log : logs) {
            log.debug();
        }

    }
}
